<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
            margin: auto;
        }
        div{
            width: 400px;
            height: 600px;

        }
        ul{
            display: flex;
            list-style: none;
            background-color: palegreen;
            font-size: 18px;
            width: 400px;
        }
        ul div{
            width: 100px;
            height: 50px;
            line-height: 50px;
            /* background-color: aqua; */
            text-align: center;
            justify-content:space-between;
        }
       
        .change{
            color: #fff;
            background-color: palevioletred;
            font-size: 30px;
        }
    </style>
    <!-- 1.引入 -->
    <script src="./vue.js"></script>
    <script src="./jquery-3.5.1.min.js"></script>
</head>
<body>
    <!-- 2.挂载 -->
    <div id="app">
        <ul>
            <div :class="con == '首页' ? 'change' : ''" @click="_click('首页')">首页</div>
            <div :class="con == '体育' ? 'change' : ''" @click="_click('体育')">体育</div>
            <div :class="con == '军事' ? 'change' : ''" @click="_click('军事')">军事</div>
            <div :class="con == '生活' ? 'change' : ''" @click="_click('生活')">生活</div> 
        </ul>
        <span>{{ con }}</span>
    </div>  
</body>
    <script>
        // 3.实例化对象构造vue函数
        new Vue({
            el:"#app",
            data:{
                classname:"change",
                con:'首页'
            },
            methods:{
                _click(con){
                    this.con = con;    
                },
            }
        })
    </script>
</html>